using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class userMap : EntityTypeConfiguration<user>
    {
        public userMap()
        {
            // Primary Key
            this.HasKey(t => new { t.User1, t.User_id, t.Password });

            // Properties
            this.Property(t => t.User1)
                .IsRequired()
                .HasMaxLength(15);

            this.Property(t => t.User_id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(t => t.Password)
                .IsRequired()
                .HasMaxLength(10);

            // Table & Column Mappings
            this.ToTable("users");
            this.Property(t => t.User1).HasColumnName("User");
            this.Property(t => t.User_id).HasColumnName("User_id");
            this.Property(t => t.Password).HasColumnName("Password");
        }
    }
}
